module.exports = function filter(arr, fn) {
  const results = [];
  for (const [index, value] of arr.entries()) {
    if (fn(value, index, arr)) {
      results.push(value);
    }
  }
  return results;
};
